﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HCM_maps_website.Models
{
    public class DirectionDTO
    {
        public List<DirectionNode> Path { get; set; }
        
        public string getIDs()
        {
            if (Path != null)
            {
                string result = string.Empty;
                foreach (DirectionNode item in Path)
                {
                    result = result + item.Id.ToString() + " "+item.DirectionGuide.ToString()+" ";
                }
                return result;
            }
            else
                return null;
        }

        public double getPathLength()
        {
            if (Path != null)
            {
                double result = 0;
                for (int i = 0; i < Path.Count - 1; i++)
                {
                    Coordinate curent = Path[i].Location;
                    Coordinate next = Path[i + 1].Location;
                    result += Coordinate.Distance(curent, next);
                }

                return result;
            }
            else
                return -1;
        }


    }

    


}
